<?php
/**
 * 
 * Digitalus2 CMS
 *
 * @package    	Digitalus\Navigation
 * @copyright  	Copyright (c) 2009,  Digitalus Media USA (http://digitalusmedia.net)
 * @license    	New BSD License, library/Dig/License.txt
 * @version 	2.0
 * 
 */
class DigNavigation_MenuController extends Zend_Controller_Action 
{ 
    /**
     * renders the selected menu
     * 
     *
     */
    public function renderAction()
    {
        $parent = $this->getRequest()->getParam('parent');
        if($parent == null) {
            $parent = DigCms_Service_Item::getDefaultItem()->id;
        }
        $levels = $this->getRequest()->getParam('levels', 1);
        $id = $this->getRequest()->getParam('id', null);
        $this->view->homeLink = $this->getRequest()->getParam('homeLink', false);
        $class = $this->getRequest()->getParam('class', null);
        $this->view->id = $id;
        if(is_array($class)) {
            $this->view->class = implode(' ', $class);
        } else {
            $this->view->class = $class;
        }
        $this->view->menuData = DigNavigation_Service_Menu::build($parent, $levels);
    }
}
?>